import request from '/@/utils/request';

export function ${lowerFirst(className)}Api() {
    return {
        page(data: Object) {
            return request({
                url: '/${module}/${lowerFirst(className)}/page',
                method: 'get',
                params: data,
            });
        },
        tree() {
            return request({
                url: '/${module}/${lowerFirst(className)}/tree',
                method: 'get',
            });
        },
        save(data: object) {
            return request({
                url: '/${module}/${lowerFirst(className)}/save',
                method: 'post',
                data,
            });
        },
        update(data: object) {
            return request({
                url: '/${module}/${lowerFirst(className)}/update',
                method: 'post',
                data,
            });
        },
        del(id: string) {
            return request({
                url: '/${module}/${lowerFirst(className)}/delete',
                method: 'post',
                data: { id: id },
            });
        },
    };
}

declare interface ${className}Type {
<%	for(attr in attrs){
if (attr.colName=="create_by" || attr.colName=="create_date" || attr.colName=="update_by" || attr.colName=="update_date") continue;
%>
${attr.name}:${lowerFirst(attr.javaType)};
<%}%>
}
